#makefile for SDL_rwlib for PSP
#ported by kehon SDL_rwlib library for SDL for psp

PSPSDK=$(shell psp-config --pspsdk-path)
PSPDEV=$(shell psp-config --psp-prefix)
PSPBIN=$(PSPDEV)/bin
INSTALL_DIR=$(shell $(PSPBIN)/sdl-config --prefix)/include/SDL

TARGET_LIB = libSDL_rwlib.a
OBJS := SDL_rwfd.o SDL_rwprintf.o SDL_rwring.o SDL_rwsock.o SDL_rwz.o \
		SDL_rwtmp.o SDL_rwtmp.o SDL_rwbz2.o SDL_rwnull.o \
		SDL_rwhttp.o SDL_rwurl.o 
 

INCDIR =  
CFLAGS = -O2 -G0 -Wall -g $(shell $(PSPBIN)/sdl-config --cflags)
CFLAGS += -I./include 
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =

LIBS = $(shell $(PSPBIN)/sdl-config --libs) -lSDL_net -lcurl -lbz2 -lz -lc -lpspuser 

include $(PSPSDK)/lib/build.mak

install:
	@mkdir -p $(INSTALL_DIR)
	cp -f include/SDL_rwbz2.h $(INSTALL_DIR)
	cp -f include/SDL_rwfd.h $(INSTALL_DIR)
	cp -f include/SDL_rwhttp.h $(INSTALL_DIR)
	cp -f include/SDL_rwlib_internal.h $(INSTALL_DIR)
	cp -f include/SDL_rwnull.h $(INSTALL_DIR)
	cp -f include/SDL_rwprintf.h $(INSTALL_DIR)
	cp -f include/SDL_rwring.h $(INSTALL_DIR)
	cp -f include/SDL_rwsock.h $(INSTALL_DIR)
	cp -f include/SDL_rwtmp.h $(INSTALL_DIR)
	cp -f include/SDL_rwurl.h $(INSTALL_DIR)
	cp -f include/SDL_rwz.h $(INSTALL_DIR)
	@mkdir -p $(shell $(PSPBIN)/sdl-config --prefix)/lib
	cp -f $(TARGET_LIB) $(shell $(PSPBIN)/sdl-config --prefix)/lib
	@echo
	@echo "** Headerfiles installed in $(INSTALL_DIR)"
	@echo "** Library files installed in $(shell $(PSPBIN)/sdl-config --prefix)/lib"